package com.jingdianjichi.club.gateway.enums;

import lombok.Getter;

/**
 * ResultCode
 *
 * @author 86178
 * @version 2024/03/17 21:03
 **/
@Getter
public enum ResultCodeEnum {

    SUCCESS(200, "成功"),
    FAIL(500, "失败");

    public int code;

    public String description;

    ResultCodeEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static ResultCodeEnum getByCode(int codeVal) {
        for (ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()) {
            if (resultCodeEnum.code == codeVal) {
                return resultCodeEnum;
            }
        }
        return null;
    }
}

